package com.bort.system.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bort.system.info.DeskInfo;

public class Result<T> {

    public Result() {
        code = 200;
        msg = "请求成功";
    }

    private int code;

    private String msg;

    private T data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static Result error(){
       return error("操作失败");
    }

    public static Result error(String msg){
        Result result = new Result();
        result.setCode(0);
        result.setMsg(msg);
        return  result;
    }

    public static Result success(){
        return success("操作成功");
    }

    public static Result success(String msg) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg(msg);
        return  result;
    }

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setData(data);
        return result;
    }


}
